{# ----------------------------------------------------------------------------
 # SymForce - Copyright 2022, Skydio, Inc.
 # This source code is under the Apache 2.0 license found in the LICENSE file.
 # ---------------------------------------------------------------------------- #}

{%- import "../../util/util.jinja" as util with context -%}

#include <sym/{{ camelcase_to_snakecase(cls.__name__) }}.h>

#include "./group_ops.h"

namespace sym {

{% for spec in specs['GroupOps'] %}
{% if spec.docstring %}
/**
{% for line in spec.docstring.split('\n') %}
 *{{ ' {}'.format(line).rstrip() }}
{% endfor %}
 */
{% endif %}
template <typename Scalar>
{% set dim = ops.LieGroupOps.tangent_dim(cls) %}
{{ util.function_declaration_custom_namespace(spec, "GroupOps<" + cls.__name__ + "<Scalar>>", is_declaration=False).replace(
    "Eigen::Matrix<Scalar, {}, {}>".format(dim, dim), "SelfJacobian"
)}} {
    {{ util.expr_code(spec) -}}
}

{% endfor %}

}  // namespace sym

// Explicit instantiation
{% for Scalar in scalar_types %}
template struct sym::GroupOps<sym::{{ cls.__name__ }}<{{ Scalar }}>>;
{% endfor %}
